#pragma once

#include "RBTree.h"


namespace my_std
{
	template <class K, class V>
	class my_map
	{
		struct MapKeyofT
		{
			const K& operator()(const pair<const K, V>& kv)
			{
				return kv.second;
			}
		};
		typedef RBTree<K, pair<const K, V>, MapKeyofT> RBTree;
		typedef typename RBTree::iterator iterator;
		typedef typename RBTree::const_iterator const_iterator;
	public:
		iterator begin()
		{
			return _rb.begin();
		}

		iterator end()
		{
			return _rb.end();
		}


		const_iterator begin()const
		{
			return _rb.begin();
		}

		const_iterator end()const
		{
			return _rb.end();
		}

		pair<iterator,bool> insert(const pair<const K, V>& kv)
		{
			return _rb.insert(kv);
		}

		bool IsBalance()
		{
			return _rb.IsBalance();
		}


		int Height()
		{
			return _rb.Height();
		}

	private:
		RBTree _rb;
	};
}